﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using WLFramework.Data;
using WLFramework.Json;

namespace GenericHtml
{
    public static class GenericConfigure
    {
        public delegate DbManager CreateDbManagerDelegate();

        public delegate void LogDelegate(int user, int table, string action);

        public static CreateDbManagerDelegate CreateDbManager { get; set; }

        public static LogDelegate Log { get; set; }

        public static IDynamicMetadataProvider Provider { get; set; }

        public static void Configure()
        {
            if (CreateDbManager == null)
                throw new ArgumentNullException("CreateDbManager");
            if (Log == null)
                throw new ArgumentNullException("Log");
            if (Provider == null)
                throw new ArgumentNullException("Provider");

            MetadataManager.Initialize();
        }

        public static JSONResult LoginFailed = new JSONResult("failed", "登录失效, 请重新登录");
    }
}
